package com.jvtd.demo;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.Button;
import android.widget.TextView;

import com.jvtd.demo.alertDialog.AlertDialogActivity;
import com.jvtd.demo.amap.GdActivity;
import com.jvtd.demo.dropDownMenu.DropDownMenuActivity;
import com.jvtd.demo.im.ImInitActivity;
import com.jvtd.demo.pickerView.PickerViewActivity;
import com.jvtd.demo.rcView.RcViewActivity;
import com.jvtd.demo.recyclerView.RecyclerViewActivity;
import com.jvtd.demo.stvView.StvViewActivity;
import com.jvtd.demo.umeng.UmengActivity;
import com.jvtd.demo.webView.WebViewActivity;
import com.jvtd.demo.zego.ZegoActivity;
import com.jvtd.widget.imageSelector.JvtdIS;

public class MainActivity extends AppCompatActivity {

    @SuppressLint("CheckResult")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        TextView mRvBtn = findViewById(R.id.recyclerview);
        mRvBtn.setOnClickListener(view -> toRv());
        TextView mAdBtn = findViewById(R.id.alertdialog);
        mAdBtn.setOnClickListener(view -> toAd());
        TextView mPvBtn = findViewById(R.id.pickerview);
        mPvBtn.setOnClickListener(view -> toPv());
        TextView mWvBtn = findViewById(R.id.webview);
        mWvBtn.setOnClickListener(view -> toWv());
        TextView mRcBtn = findViewById(R.id.rcview);
        mRcBtn.setOnClickListener(view -> toRc());
        TextView mStvBtn = findViewById(R.id.stvview);
        mStvBtn.setOnClickListener(view -> toStv());
        TextView mIsBtn = findViewById(R.id.imageSelector);
        mIsBtn.setOnClickListener(view -> toIs());
        TextView mDdmBtn = findViewById(R.id.dropdownmenu);
        mDdmBtn.setOnClickListener(view -> toDdm());
        TextView mUmBtn = findViewById(R.id.umeng);
        mUmBtn.setOnClickListener(view -> toUm());
        TextView mZegoBtn = findViewById(R.id.zego);
        mZegoBtn.setOnClickListener(view -> toZego());
        Button mImBtn = findViewById(R.id.im);
        mImBtn.setOnClickListener(view -> toIm());
        Button mGdMapBtn = findViewById(R.id.gd_location);
        mGdMapBtn.setOnClickListener(view -> toGdLocation());
    }

    private void toZego() {
        startActivity(ZegoActivity.class);
    }

    private void toUm() {
        startActivity(UmengActivity.class);
    }

    private void toDdm() {
        startActivity(DropDownMenuActivity.class);
    }

    private void toIs() {
        JvtdIS.getInstance().toListActivity(this,20,1);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 1){

        }
    }

    private void toStv() {
        startActivity(StvViewActivity.class);
    }

    private void toRc() {
        startActivity(RcViewActivity.class);
    }

    private void toWv() {
        startActivity(WebViewActivity.class);
    }

    private void toPv() {
        startActivity(PickerViewActivity.class);
    }

    private void toAd() {
        startActivity(AlertDialogActivity.class);
    }

    private void toRv(){
        startActivity(RecyclerViewActivity.class);
    }

    private void toIm() {startActivity(ImInitActivity.class);}

    private void toGdLocation()
    {
        startActivity(GdActivity.class);
    }

    private void startActivity(Class<?> atClass){
        startActivity(new Intent(this, atClass));
    }
}
